package com.zhang.springbootdemo.controller;

import com.zhang.springbootdemo.pojo.Student;
import com.zhang.springbootdemo.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class StudentController {
    @Autowired
    private StudentService studentService;

    //全部查询
    @RequestMapping("/stulist")
    public List<Student> studentList(){

        return studentService.studentList();
    }
    //单个查询
    @RequestMapping("/stulist/{tid}")
    public List<Student> studentList(@PathVariable("tid") int id){
        return studentService.studentList(id);
    }
}
